﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MMeller.Net.MultiHashmap
{
    internal class SimpleDictionary<K,V> : IInternalDict<K,V>
    {
        private Dictionary<K, V> dictionary;

        public SimpleDictionary()
        {
            this.dictionary = new Dictionary<K, V>();
        }

        public void Add(K key, V value)
        {
            this.dictionary[key] = value;
        }

        public void Clear()
        {
            this.dictionary.Clear();
        }

        public bool Remove(K key)
        {
            return this.dictionary.Remove(key);
        }

        public bool Remove(K key, V value)
        {
            if (this.dictionary[key].Equals(value))
            {
                return this.dictionary.Remove(key);
            }
            else return false;
        }

        public V[] getElement(K key)
        {
            return new V[] { this.dictionary[key] };
        }
    }
}
